Hy (programming language)
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
top
Hy is a dialect of the Lisp programming language designed to interact with Python by translating s-expressions into Python's abstract syntax tree (AST).cite-ref-2[2]cite-ref-3[3] Hy was introduced at Python Conference (PyCon) 2013 by Paul Tagliamonte.cite-ref-4[4] Lisp allows operating on code as data (metaprogramming), thus Hy can be used to write domain-specific languages.cite-ref-5[5]
Similar to Kawa's and Clojure's mappings onto the Java virtual machine (JVM),cite-ref-6[6]cite-ref-7[7] Hy is meant to operate as a transparent Lisp front-end for Python.cite-ref-lwn-8-0[8] It allows Python libraries, including the standard library, to be imported and accessed alongside Hy code with a compilingcite-ref-9[note 1] step where both languages are converted into Python's AST.cite-ref-10[note 2]cite-ref-11[9]cite-ref-12[10]cite-ref-13[11]
Contents
• See also
• Notes
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Example code
From the language documentation:cite-ref-14[12]
=> (print "Hy!")
Hy!
=> (defn salutationsnm [name] (print (+ "Hy " name "!")))
=> (salutationsnm "YourName")
Hy YourName!
See also
Notes
cite-note-9note 1. ↑ The term "compiled" may apply to expressing Hy code in Python's AST or converting that AST into bytecode, the latter being dependent on the specific Python interpreter used and not Hy.
References
cite-note-wikidata-97a7f3cbb5f88ae6337adde1758a479fb1af9cf0-v20-11. "Release 1.1.0". 8 May 2025. Retrieved 25 May 2025.
cite-note-44. ↑ citereftagliamonte2013Tagliamonte, Paul (2 April 2013). PyCon lightning talk (Speech). Python Conference (PyCon). Santa Clara. Retrieved 2 September 2014.
cite-note-66. ↑ citerefturto2014Turto, Tuukka (14 February 2014). "Programming Can Be Fun with Hy". Open Source For You. Retrieved 2 September 2014.
cite-note-77. ↑ citerefwatson2020Watson, Mark (2020). A Lisp Programmer Living in Python-Land: The Hy Programming Language (PDF). LeanBooks.
cite-note-119. ↑ "Hy Documentation". hylang.org. Retrieved 3 September 2014.
cite-note-1210. ↑ citerefdanjou2014Danjou, Julien (26 March 2014). "The AST". The Hacker's Guide to Python. pp. 165–172.
cite-note-1311. ↑ citerefkitchin2016Kitchin, John (31 March 2016). "More on Hy and why I think it is a big deal". The Kitchin Research Group. Carnegie Mellon University. Retrieved 19 September 2018.
cite-note-1412. ↑ "Quickstart". Hylang.org. 15 May 2018. Retrieved 19 September 2018.
External links